import React,{useState} from 'react'
import  Child1 from  "../components/Child1";

// eslint-disable-next-line import/no-anonymous-default-export
export default  ()=> {
    
  let [num,setNum] =useState(10);

  let [username,setUsername]= useState("");





  return (
    <div>UseState

        <h3>{num}</h3>
        <button onClick={()=>{
            setNum(num+1);

        }}>+</button>

        <div>
            用户名  <input type="text" value={username} onChange={(e)=>{
                setUsername(e.target.value);
            }} />
        </div>

            <button onClick={()=>{
                alert(username);
            }}>获取用户名</button>
        <Child1 num={num} setUsername={setUsername}></Child1>
    </div>
  )
}
